package com.karst.essentials.chapter04
{
	import flash.display.Sprite;
	
	public class Chapter04View extends Sprite
	{
		public static const SECTION_LIST : Array = 
			["WireframeMaterial-线框材质", "ColorMaterial-颜色材质",
			 "BitmapMaterial-位图材质(代码位图形状)", "BitmapMaterial-位图材质(外部位图文件)",
			 "BitmapFileMaterial-位图文件材质", "BitmapAssetMaterial-位图元件材质(IDE专用)",
			 "MovieMaterial-影片材质", "MovieAssetMaterial-影片元件材质(IDE专用)",
			 "VideoStreamMaterial-视频流材质", "Combining materials-组合材质",
			 "Interactivity-交互", "Tiling-平铺",
			 "Flipping-翻转材质", "finalMaterialExample-旋转木马"
			 ] ;
		
		public function Chapter04View()
		{
			super();
		}
		
		
		public function showSection( $section : String = "" ) : void
		{
			while( numChildren )
				removeChildAt( 0 ) ;
			switch( $section )
			{
				case SECTION_LIST[0] :
					createWireframeMaterialExample() ;
					break ;
				case SECTION_LIST[1] :
					createColorMaterialExample() ;
					break ;
				case SECTION_LIST[2] :
					createBitmapMaterialShapeExampl() ;
					break ;
				case SECTION_LIST[3] :
					createBitmapMaterialImageExample() ;
					break ;
				case SECTION_LIST[4] :
					createBitmapFileMateriaExample() ;
					break ;
				case SECTION_LIST[5] :
					createBitmapAssetMaterialExample() ;
					break ;
				case SECTION_LIST[6] :
					createMovieMaterialExample() ;
					break ;
				case SECTION_LIST[7] :
					createMovieAssetMaterialExample() ;
					break ;
				case SECTION_LIST[8] :
					createVideoMaterialExample() ;
					break ;
				case SECTION_LIST[9] :
					createCompositeMaterialExample() ;
					break ;
				case SECTION_LIST[10] :
					createDo3dInteractiveExample() ;
					break ;
				case SECTION_LIST[11] :
					createMaterialTilingExample() ;
					break ;
				case SECTION_LIST[12] :
					createMaterialFlipExample() ;
					break ;
				case SECTION_LIST[13] :
					createFinalMaterialExample() ;
					break ;
				default :
					break ;
			}
		}

		private var wireframeMaterialExample : WireframeMaterialExample = null ;
		private function createWireframeMaterialExample() : void
		{
			if( wireframeMaterialExample == null )
				wireframeMaterialExample = new WireframeMaterialExample() ;
			addChild( wireframeMaterialExample ) ;
		}

		private var colorMaterialExample : ColorMaterialExample = null ;
		private function createColorMaterialExample() : void
		{
			if( colorMaterialExample == null )
				colorMaterialExample = new ColorMaterialExample() ;
			addChild( colorMaterialExample ) ;
		}

		private var bitmapMaterialShapeExampl : BitmapMaterialShapeExampl = null ;
		private function createBitmapMaterialShapeExampl() : void
		{
			if( bitmapMaterialShapeExampl == null )
				bitmapMaterialShapeExampl = new BitmapMaterialShapeExampl() ;
			addChild( bitmapMaterialShapeExampl ) ;
		}

		private var bitmapMaterialImageExample : BitmapMaterialImageExample = null ;
		private function createBitmapMaterialImageExample() : void
		{
			if( bitmapMaterialImageExample == null )
				bitmapMaterialImageExample = new BitmapMaterialImageExample() ;
			addChild( bitmapMaterialImageExample ) ;
		}

		private var bitmapFileMateriaExample : BitmapFileMateriaExample = null ;
		private function createBitmapFileMateriaExample() : void
		{
			if( bitmapFileMateriaExample == null )
				bitmapFileMateriaExample = new BitmapFileMateriaExample() ;
			addChild( bitmapFileMateriaExample ) ;
		}

		private var bitmapAssetMaterialExample : BitmapAssetMaterialExample = null ;
		private function createBitmapAssetMaterialExample() : void
		{
			if( bitmapAssetMaterialExample == null )
				bitmapAssetMaterialExample = new BitmapAssetMaterialExample() ;
			addChild( bitmapAssetMaterialExample ) ;
		}

		private var movieMaterialExample : MovieMaterialExample = null ;
		private function createMovieMaterialExample() : void
		{
			if( movieMaterialExample == null )
				movieMaterialExample = new MovieMaterialExample() ;
			addChild( movieMaterialExample ) ;
		}

		private var movieAssetMaterialExample : MovieAssetMaterialExample = null ;
		private function createMovieAssetMaterialExample() : void
		{
			if( movieAssetMaterialExample == null )
				movieAssetMaterialExample = new MovieAssetMaterialExample() ;
			addChild( movieAssetMaterialExample ) ;
		}

		private var videoMaterialExample : VideoMaterialExample = null ;
		private function createVideoMaterialExample() : void
		{
			if( videoMaterialExample == null )
				videoMaterialExample = new VideoMaterialExample() ;
			addChild( videoMaterialExample ) ;
		}

		private var compositeMaterialExample : CompositeMaterialExample = null ;
		private function createCompositeMaterialExample() : void
		{
			if( compositeMaterialExample == null )
				compositeMaterialExample = new CompositeMaterialExample() ;
			addChild( compositeMaterialExample ) ;
		}

		private var do3dInteractiveExample : Do3dInteractiveExample = null ;
		private function createDo3dInteractiveExample() : void
		{
			if( do3dInteractiveExample == null )
				do3dInteractiveExample = new Do3dInteractiveExample() ;
			addChild( do3dInteractiveExample ) ;
		}

		private var materialTilingExample : MaterialTilingExample = null ;
		private function createMaterialTilingExample() : void
		{
			if( materialTilingExample == null )
				materialTilingExample = new MaterialTilingExample() ;
			addChild( materialTilingExample ) ;
		}

		private var materialFlipExample : MaterialFlipExample = null ;
		private function createMaterialFlipExample() : void
		{
			if( materialFlipExample == null )
				materialFlipExample = new MaterialFlipExample() ;
			addChild( materialFlipExample ) ;
		}

		private var finalMaterialExample : FinalMaterialExample = null ;
		private function createFinalMaterialExample() : void
		{
			if( finalMaterialExample == null )
				finalMaterialExample = new FinalMaterialExample() ;
			addChild( finalMaterialExample ) ;
		}
	}
}